# -*- coding:utf-8 -*-
class Solution:
    def FirstNotRepeatingChar(self, s):
        # write code here
        # d = {}
        # for i in range(0,len(s)):
        #     if s[i] not in d:
        #         d[s[i]] = i
        #     else:
        #         d[s[i]] = -1
        # print(d)
        # for i in d:
        #     if d[i]!=-1:
        #         return d[i]
        # return -1
        if not s:
            return -1
        d = {}
        for i in range(len(s)):
            if s[i] not in d.keys():
                d[s[i]] = 1
            else:
                d[s[i]] += 1
        for k, v in d.items():
            if v == 1:
                return s.index(k)
        return -1

s = Solution()
print(s.FirstNotRepeatingChar('google'))